package com.lagou.niancheng.rpc.server.handler;

import com.lagou.niancheng.rpc.common.entity.ServerGetRequest;
import com.lagou.niancheng.rpc.common.handler.RequestHandler;
import com.lagou.niancheng.rpc.server.SimpleRpcMethodRegistry;

/**
 * com.lagou.niancheng.rpc.server.handler.ServerGetRequestHandler
 *
 * @author 大犬
 * @date 2020/4/30
 */
public class ServerGetRequestHandler implements RequestHandler<ServerGetRequest> {

    private SimpleRpcMethodRegistry simpleRpcMethodRegistry;

    public ServerGetRequestHandler(SimpleRpcMethodRegistry simpleRpcMethodRegistry) {
        this.simpleRpcMethodRegistry = simpleRpcMethodRegistry;
    }

    @Override
    public Object handle(ServerGetRequest data) {
        String serverTypeName = data.getServerTypeName();
        return simpleRpcMethodRegistry.getServiceMetaData(serverTypeName);
    }
}
